import {
    NativeModules,
} from 'react-native';

//云信登录
export function login(account, token, onError){
    NativeModules.H5NeteaseP2P.login(account.toString(), token, onError);
}

//登出
export function logout(){
    NativeModules.H5NeteaseP2P.logout();
}

//最近联系人列表
export function recentChat(onSuccess){
    NativeModules.H5NeteaseP2P.recentChats(onSuccess);
}

//获取聊天记录
export function getChatLog(account, time, onSuccess){
    NativeModules.H5NeteaseP2P.getChatLog(account, time.toString(), onSuccess);
}

//发送文本消息
export function sendTxtMsg(fuid, tuid, content){
    NativeModules.H5NeteaseP2P.sendTxtMsg(fuid, tuid, content);
}

//聊天室登录
export function chatroomLogin(roomid){
    NativeModules.H5NeteaseChatRoom.enterRoom(roomid);
}

//退出聊天室
export function chatroomLeave(roomid){
    NativeModules.H5NeteaseChatRoom.leaveRoom(roomid);
}